package com.his.his_system.mapper;

import com.his.his_system.common.util.ResultAdvice;
import com.his.his_system.controller.VisitController.DefaultBean.HanZhe;
import com.his.his_system.controller.VisitController.DefaultBean.Schenduling;
import com.his.his_system.domain.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 余襄元
 */
public interface DefaultMapper {
    /**
     * 医生排版=》获取排班list列表 +模糊查询
     *
     * @param id 医院id
     * @return
     */
    List<Doctorscheduling> getAllScheduling(@Param("id") Integer id, @Param("name")String name,@Param("ks")Integer ks , @Param("date")String date);

    /**
     * 根据医院id获取所有医生
     *
     * @param id 医院id
     * @return
     */
    List<DzmHisAuthGroup> getDoctor(@Param("id") Integer id);

    /**
     * 获取已挂号列表
     *
     * @param hostoryid 医院id =>
     */
    List<DzmHisRegistration> getAllRegister(@Param("hostoryid") Integer hostoryid,@Param("pid") String pid);


    /**待删除
     * 门诊列表=》模糊查询
     *
     * @return
     */
    List<DzmHisRegistration> getPatientbynameAndguahaodate(String name, Integer start, Integer end, int stuar, Integer doctorid);


    /**
     * 模糊查询挂号列表
     *
     * @param patientName 患者姓名
     * @param doctorid    医生id
     */
    List<DzmHisRegistration> getRegisterlistByname(@Param("doctorid") Integer doctorid, @Param("patientName") String patientName);


    /**
     * 根据患者id查询所有病例
     *
     * @param historyid 医院id
     * @param patientid 患者id
     * @return
     */
    List<DzmHisCareHistory> getAllHistoryByPatientId(@Param("historyid") Integer historyid, @Param("patientid") Integer patientid);


    /**
     * 获取可预约的的排班信息
     *
     * @return
     */
    List<Schenduling> getAllSchedulingByNow(@Param("historyid") Integer historyid,@Param("did") Integer did,@Param("rid") Integer rid,@Param("name") String name);


    /**
     * 模糊查询获取可预约的的排班信息
     *
     * @return
     */
    List<Schenduling> selectsched(@Param("doctorname") String doctorname,@Param("historyid") Integer historyid);


    /**3
     * 获取门诊列表
     * @param doctorid
     * @return
     */
    List<DzmHisRegistration> getAllVisit(@Param("doctorid") Integer doctorid,@Param("hostoryid") Integer hostoryid,@Param("i") Integer i,@Param("name") String name,@Param("php")String php,@Param("today") String today);

    /**
     * 获取已就诊
     * @param
     * @param
     * @return
     */
    List<HanZhe> getAllRegisterToday2(@Param("namephp")String namephp ,@Param("did")Integer did,@Param("hid")Integer hid);

        /**
         * 首页模糊查询
         * @param doctorid
         * @param hostoryid
         * @param i
         * @param namephp
         * @param today
         * @return
         */
    List<DzmHisRegistration> getAllVisit1(@Param("doctorid") Integer doctorid,@Param("hostoryid") Integer hostoryid,@Param("i") Integer i,@Param("namephp") String namephp,@Param("today") String today);

    List<HanZhe> getAllyiRegister(@Param("name")String name, @Param("php")String php,@Param("hid")Integer hid ,@Param("did")Integer did);

    List<DzmHisDepartment> getAllDoctorbydepid(@Param("hid")Integer hid);


    /**
     * 获取所有病例
     */
    List<DzmPatient> getAllHistory(@Param("name") String name,@Param("depname")String depname,@Param("hid") Integer hid);


    /**
     * 执行定时任务
     */
    @Select("select a.* from dzm_his_registration as a ,dzm_his_scheduling_week as b " +
            " where a.scheduling_week_id=b.scheduling_week_id " +
            " and a.registration_status=5 and now()>b.date ")
     List<DzmHisRegistration> getAlreadyReg();
}
